package com.xzs.data.controller;

import com.xzs.data.dao.ReturnDataDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class DataController {


    @Autowired
    private ReturnDataDao returnDataDao;

    @GetMapping("/{key}")
    public String key(@PathVariable String key) {
        String uri = key;
        return returnDataDao.selectByUri(uri);
    }
    @GetMapping("/{key}/{key1}")
    public String key2(@PathVariable String key,@PathVariable String key1) {
        String uri = "/"+key+"/"+key1;
        return returnDataDao.selectByUri(uri);
    }
    @GetMapping("/{key}/{key1}/{key2}")
    public String key3(@PathVariable String key,@PathVariable String key1,@PathVariable String key2) {
        String uri = "/"+key+"/"+key1+"/"+key2;
        return returnDataDao.selectByUri(uri);
    }
    @GetMapping("/{key}/{key1}/{key2}/{key3}")
    public String key4(@PathVariable String key,@PathVariable String key1,@PathVariable String key2,@PathVariable String key3) {
        String uri = "/"+key+"/"+key1+"/"+key2+"/"+key3;
        return returnDataDao.selectByUri(uri);
    }
}
